day01-1-数字统计
测试链接：https://www.nowcoder.com/practice/179d9754eeaf48a1b9a49dc1d438525a?tpld=2908tqld=39941&ru=/exam/oj
#include <iostream>
#include <string>
using namespace std;

int f(int n)
{
    int x = 0;
    while(n != 0)
    {
        if(n %10 == 2)
        {
            x++;
        }
        n /= 10;
    }
    return x;
}
int main() {
    int a, b;
    while (cin >> a >> b) { // 注意 while 处理多个 case
        int ret = 0;
        for(int i = a; i <= b; i++)
        {
            ret += f(i);
           
        }
         cout << ret;
    }
}
// 64 位输出请用 printf("%lld")